class Rule( object ):

    def __init__(self, id=None, table='None', source='None', i_source='None', destination='None',
                 i_destination='None', protocol='None', dport='None', target='None',
                 module='None', extra='None'):

        self.__id            = id
        self.__table         = table  
        self.__source        = source
        self.__i_source      = i_source
        self.__destination   = destination
        self.__i_destination = i_destination
        self.__protocol      = protocol
        self.__dport         = dport
        self.__target        = target
        self.__module        = module
        self.__extra         = extra

    def __cmp__(self, rule):
        try: 
            """
            table         = (rule.getTable(),        'None') [rule.getTable()        == None]
            source        = (rule.getSource(),       'None') [rule.getSource()       == None]
            i_source      = (rule.getISource(),      'None') [rule.getISource()      == None]
            destination   = (rule.getDestination(),  'None') [rule.getDestination()  == None]
            i_destination = (rule.getIDestination(), 'None') [rule.getIDestination() == None]
            protocol      = (rule.getProtocol(),     'None') [rule.getProtocol()     == None]
            d_port        = (rule.getDPort(),        'None') [rule.getDPort()        == None]
            target        = (rule.getTarget(),       'None') [rule.getTarget()       == None]
            """

            table         = rule.getTable()
            source        = rule.getSource()
            i_source      = rule.getISource()
            destination   = rule.getDestination()
            i_destination = rule.getIDestination()
            protocol      = rule.getProtocol()
            d_port        = rule.getDPort()
            target        = rule.getTarget()

            if (self.__table         == table         and
                self.__source        == source        and
                self.__i_source      == i_source      and
                self.__destination   == destination   and
                self.__i_destination == i_destination and
                self.__protocol      == protocol      and
                self.__dport         == d_port        and
                self.__target        == target        ):
                return 0 
            else:
                return -1
        except AttributeError:
            print "Solo se pueden comprar rules"

    def setId(self, id):
        self.__id = id

    def setTable(self, table):
        self.__table = table

    def setSource(self, source):
    	"""docstring for setSource"""
        self.__source = source

    def setISource(self, isource):
    	"""docstring for setISource"""
        self.__i_source = isource

    def setDestination(self, destination):
    	"""docstring for setDestination"""
        self.__destination = destination

    def setIDestination(self, idestination):
    	"""docstring for setDestination"""
        self.__i_destination = idestination

    def setProtocol(self, protocol):
    	"""docstring for setProtocol"""
        self.__protocol = protocol

    def setDPort(self, dport):
    	"""docstring for setDPort"""
        self.__dport = dport

    def setTarget(self, target):
        """docstring for setTarget"""
        self.__target = target

    def setModule(self, module):
    	"""docstring for setModule"""
        self.__module = module

    def setExtra(self, extra):
    	"""docstring for setExtra"""
        self.__extra = extra

    def getId(self):
        self.__id = id

    def getTable(self):
        return self.__table

    def getSource(self):
    	"""docstring for setSource"""
        return self.__source

    def getISource(self):
    	"""docstring for setISource"""
        return self.__i_source

    def getDestination(self):
    	"""docstring for setDestination"""
        return self.__destination

    def getIDestination(self):
    	"""docstring for setDestination"""
        return self.__i_destination

    def getProtocol(self):
    	"""docstring for setProtocol"""
        return self.__protocol

    def getDPort(self):
    	"""docstring for setDPort"""
        return self.__dport

    def getTarget(self):
        """docstring for setTarget"""
        return self.__target

    def getModule(self):
    	"""docstring for setModule"""
        return self.__module

    def getExtra(self):
    	"""docstring for setExtra"""
        return self.__extra

    def getDATA(self):
        return self.__id, self.__table, self.__source, self.__i_source,   \
               self.__destination, self.__i_destination, self.__protocol, \
               self.__dport, self.__target, self.__module, self.__extra
